#ifndef RESPONSE_H
#define	RESPONSE_H
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <string>
#include "Cache.h"
using namespace std;


// Represents an HTTP response.
class Response
{
public:
    // The status code representing the type of response.
    string statusCode;
    //the filename being requested
    string fileName;
    //
    string method;
    
    // The optional text description of the status code.
    string reasonPhrase;
    
    // The header of the repsonse.
    stringstream responseHeader;
    
    // Indicates a file is included in the response.
    bool fileToSend;
    
    // The file to return for get request.
    ifstream responseFile;
    
    // The total length of the responseFile length.
    long long responseLength;
    
    //length of the header
    long long responseHeaderLength;
    
    stringstream headers;
    
    struct CacheItem returnData;
    
    // Constructor to build a response for the specified request.
    Response();
    Response(const Response& data);
   // static char* Rfc1123_DateTimeNow();
    void MakeHeader();
    
    static void SendResponse(Response& resp, int socket, string baseDir);
private:
    static const string HTTP_VERSION;
    
    
    
};
#endif
